<?php
/**
 * Data model
 *
 * @category  DataModel
 * @package   DataModel
 * @author    DataModel Generator v1.3
 * @version   Revision: $Rev$
 */
/**
 * Data model for table "user"
 *
 * @category  DataModel
 * @package   DataModel
 * @author    DataModel Generator v1.3
 * @version   Revision: $Rev$
 *
 * @property-read mixed Id
 * @property-read mixed Login
 * @property-read mixed Passwd
 * @property-read mixed Email
 * @property-read mixed GoogleId
 * @property-read mixed RegistrationDate
 * @property-read mixed LastVisitDate
 * @property-read mixed CanDelete
 * @property-read mixed Avatar
 * @property-read mixed Photo
 * @property-read mixed Settings
 */
abstract class BaseUser extends BaseRecord
{
    const TABLE_NAME = "user";

    public function __construct()
    {
        parent::__construct(self::TABLE_NAME);
    }

    protected function initFields()
    {
        $this->hasColumn('id', 'PA:int(3)');
        $this->hasColumn('login', 'N:varchar(16)');
        $this->hasColumn('passwd', 'N:varchar(64)');
        $this->hasColumn('email', 'N:varchar(60)');
        $this->hasColumn('google_id', 'N:varchar(60)');
        $this->hasColumn('registration_date', 'timestamp|CURRENT_TIMESTAMP');
        $this->hasColumn('last_visit_date', 'timestamp|0000-00-00 00:00:00');
        $this->hasColumn('can_delete', 'N:tinyint(1)|1');
        $this->hasColumn('avatar', 'N:varchar(255)');
        $this->hasColumn('photo', 'N:varchar(255)');
        $this->hasColumn('settings', 'N:text');
    }

    public function initRelations()
    {
    }

    public function getById($id)
    {
        return parent::getById($id, 'User');
    }

    public function getByParams( $params, $type = ORMRecord::ONE_RECORD, $limit = null )
    {
        return parent::getByParams( $params, $type, $limit, 'User');
    }

    public function getAll( $limit = null )
    {
        return parent::getAll( $limit, 'User' );
    }
}